﻿Imports BUS
Imports DTO


Public Class MH_BangDiemMon

    Private Sub btnDong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDong.Click
        Me.Close()
    End Sub

    Private Sub btnLayBangDiem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLayBangDiem.Click
        Dim strSQL As String = "SELECT HOCSINH.HoTen, CHITIETDIEM.Diem15P, CHITIETDIEM.Diem1T, CHITIETDIEM.DiemHK "
        strSQL = strSQL + " FROM HOCSINH INNER JOIN (DIEMMONHOC INNER JOIN CHITIETDIEM ON DIEMMONHOC.MaDiemMonHoc = CHITIETDIEM.MaDiemMonHoc) ON HOCSINH.MaHocSinh = CHITIETDIEM.MaHocSinh "
        strSQL = strSQL + " WHERE DIEMMONHOC.MaLop = " + cboLop.SelectedValue.ToString() + " And DIEMMONHOC.MaMon = " + cboMon.SelectedValue.ToString() + " And DIEMMONHOC.MaHocKy = " + cboHocKy.SelectedValue.ToString()

        Dim tvcBUS As New ThuVienChungBUS
        Dim dt As New DataTable
        dt = tvcBUS.LayBang(strSQL)

        dgvDanhSach.Rows.Clear()
        Dim i As Integer = 0
        For Each row As DataRow In dt.Rows
            i = i + 1
            dgvDanhSach.Rows.Add(i, row("HoTen"), row("Diem15P"), row("Diem1T"), row("DiemHK"))
        Next


    End Sub

    Private Sub MH_BangDiemMon_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Load danh sach Lop
        Dim lopBUS As New LopBUS
        Dim dsLop As List(Of LopDTO) = lopBUS.LayDanhSach()
        cboLop.DataSource = dsLop
        cboLop.ValueMember = ("MaLop")
        cboLop.DisplayMember = ("TenLop")
        'Load danh sách học kỳ
        Dim hkBUS As New HocKyBUS
        Dim dtHK As DataTable = hkBUS.LayBang()
        cboHocKy.DataSource = dtHK
        cboHocKy.DisplayMember = ("TenHocKy")
        cboHocKy.ValueMember = ("MaHocKy")
        'Load danh sách môn học
        Dim mhBUS As New MonHocBUS
        Dim dtMH As DataTable = mhBUS.LayBang()
        cboMon.DataSource = dtMH
        cboMon.DisplayMember = ("TenMon")
        cboMon.ValueMember = ("MaMon")
    End Sub
End Class